xxxxxxxxxxmodule teapo.docs.types.text { export function load(fullPath: string, read: (property: string) => string, write: (property: string, content: string) => void): DocumentHandler { return null; } var editorCache: { cm: CodeMirror; host: HTMLElement; } [] = []; export class TextDocumentHandler implements DocumentHandler {​ private _doc: CodeMirror.Doc = null;​ constructor( private _read: (property: string) => string, private _write: (property: string, content: string) => void) { var text = this._read(null); this._doc = new CodeMirror.Doc(text);​ // TODO: process history and/or cusor/scroll position }​ open(): HTMLElement {​ if (editorCache.length) { } }​ close() { }​ } function createEditor(): CodeMirror { }}